Embodiments of the present invention relate generally to debugging agents, and, more particularly, to breakpoint handling in Java™ debugging agents.
When debugging a software application, it is often desirable to set breakpoints to cause a debugger agent to stop at a predefined location for debugging purposes. In many typical Java™ debuggers, upon receiving a breakpoint request, the debugger agent assigns a request identifier and associates certain relevant information (e.g., location information, including a class identifier, a method identifier, a method offset, etc.) with the breakpoint request in a data structure. When the debugger agent runs the program for debugging, a copy of the program bytecode may be made, in which the source bytecode at each breakpoint location is replaced by a special breakpoint opcode. The breakpoint opcode in the modified bytecode copy may be used by the debugger agent to detect that a breakpoint is reached and to inform a debugger front-end (e.g., and thereby inform the programmer) that the breakpoint has been reached.
Typically, when the breakpoint opcode is reached by the debugger agent, the debugger agent supplies a special function with the current program counter, which is used to search through the data structure in which breakpoint information is stored to find the associated request identifier. Once the appropriate request identifier has been located, a reply packet may be generated for passing desired information to the requestor (e.g., the programmer) at the debugger front-end. Notably, the data structure may be complex and/or large in many cases, such that locating the appropriate request identifier may be computationally intense. Thus, it may be inefficient each time a breakpoint is encountered to search through the complex data structure as a function of the program counter to find the relevant information for generating the reply packet.